#ifndef F_CAProducerC_h
#define F_CAProducerC_h

// ***********************************************************************

// class EDROOMTopContext

// ***********************************************************************



class EDROOMTopContext {

protected:

enum EDROOMCAProducerSignal { EDROOMSignalTimeout, EDROOMSignalDestroy, SData, SConReady };


	friend class CAProducer;

	CAProducer &EDROOMcomponent;

	CEDROOMMessage * &Msg;

	CEDROOMMessage * &MsgBack;

	//Ports

	CEDROOMInterface & pOut;

	enum edroomStateId{I, Ready};

	enum IdTrans{Init, SendData, SendData_DataOk, SendData_ResetData,  EDROOMMEMORIA };

	//Constantes

	const TEDROOMByte VauxLimit;


	//Variables

	TEDROOMByte &Vaux;


	//Pool

	class CEDROOMPOOLTEDROOMByte:public CEDROOMProtectedMemoryPool {
		public:
		CEDROOMPOOLTEDROOMByte(TEDROOMUInt32 elemCount,TEDROOMByte *pMem, TEDROOMBool *pMarks);
		TEDROOMByte	* AllocData();
	};
	CEDROOMPOOLTEDROOMByte	& EDROOMPoolTEDROOMByte;


	// CONSTRUCTORES

	EDROOMTopContext (CAProducer &act, TEDROOMByte & EDROOMpVarVaux, CEDROOMPOOLTEDROOMByte & EDROOMpPoolTEDROOMByte );

	EDROOMTopContext ( EDROOMTopContext &contex );

public:

	bool EDROOMSearchContextTrans(TEDROOMTransId &edroomCurrentTrans);

	void EDROOMNuevoMens () { EDROOMcomponent.EDROOMNewMsg(); }

	// Funciones Definidas por el usuario

	void	FResetData();

	void	FSendData();

	TEDROOMBool	GNeedReset();

};

// ***********************************************************************

// class EDROOMTopState

// ***********************************************************************



class EDROOMTopState : public EDROOMTopContext {

protected:



	EDROOMTopContext::edroomStateId edroomCurrentState;

	EDROOMTopContext::edroomStateId edroomNextState;

	//Variables

	TEDROOMByte Vaux;


	//Pools

	CEDROOMPOOLTEDROOMByte	EDROOMPoolTEDROOMByte;


public:

	// CONSTRUCTOR

	EDROOMTopState (CAProducer &act, CEDROOMMemory *pEDROOMMemory  );


	// EDROOMBehaviour**********************************************

	void EDROOMBehaviour();

	// Inicio**********************************************

	void EDROOMInicio();

	// ***********************************************************************

	// SubEstado Inicial 

	// ***********************************************************************



	TEDROOMTransId EDROOMIllegada();

	// ***********************************************************************

	// SubEstado Hoja Ready

	// ***********************************************************************



	TEDROOMTransId EDROOMReadyllegada();

};


#endif
